﻿Imports System.Reflection
Imports System.Reflection.Emit
Imports VBParser
Imports System.Collections.ObjectModel

Namespace Compiler.Semantic
    Public Class IntrinsicTypeResolver
        Inherits TypeResolver

        Public Sub New(ByVal name As IntrinsicTypeName, ByVal context As ResolveContext)
            MyBase.New(name, context)

            With context.CompileUnit.SpecialTypes
                Select Case name.IntrinsicType
                    Case IntrinsicType.Object
                        AddResult(.Object)
                    Case IntrinsicType.Boolean
                        AddResult(.Boolean)
                    Case IntrinsicType.Byte
                        AddResult(.Byte)
                    Case IntrinsicType.Char
                        AddResult(.Char)
                    Case IntrinsicType.Date
                        AddResult(.DateTime)
                    Case IntrinsicType.Decimal
                        AddResult(.Decimal)
                    Case IntrinsicType.Double
                        AddResult(.Double)
                    Case IntrinsicType.Integer
                        AddResult(.Int32)
                    Case IntrinsicType.Long
                        AddResult(.Int64)
                    Case IntrinsicType.SByte
                        AddResult(.SByte)
                    Case IntrinsicType.Short
                        AddResult(.Int16)
                    Case IntrinsicType.Single
                        AddResult(.Single)
                    Case IntrinsicType.String
                        AddResult(.String)
                    Case IntrinsicType.UInteger
                        AddResult(.UInt32)
                    Case IntrinsicType.ULong
                        AddResult(.UInt64)
                    Case IntrinsicType.UShort
                        AddResult(.UInt16)
                    Case Else
                        Throw New NotImplementedException("Not implemented for this intrinsic type")
                End Select
            End With
        End Sub

    End Class
End Namespace

